/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package controladores;

import dominio.login;
import org.springframework.web.servlet.mvc.Controller;
import org.springframework.web.servlet.ModelAndView;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import java.io.IOException;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
/**
 *
 * @author Alith
 */
public class ControladorPaginas implements Controller{
    protected final Log logger = LogFactory.getLog(getClass());
    private login objLogin = new login();
    @Override
    public ModelAndView handleRequest(HttpServletRequest hsr, HttpServletResponse hsr1) throws Exception {
        String tipo=hsr.getParameter("tipo");
        if(tipo!=null){
            Map<String, Object> myModel = new HashMap<String, Object>();
            myModel.put("id_fisio", hsr.getParameter("id_fisio"));
            if(tipo.equals("titulo")){
                return new ModelAndView("titulo");
            }else if(tipo.equals("menuCoordinador")){
                return new ModelAndView("menuCoordinador","model",myModel);
            }else if(tipo.equals("menuFisio")){
                return new ModelAndView("menuFisio","model",myModel);
            }else if(tipo.equals("menuAdmin")){
                return new ModelAndView("menuAdmin","model",myModel);
            }else if(tipo.equals("nombrecito")){
                myModel = new HashMap<String, Object>();                
                myModel.put("nombre", hsr.getParameter("nombre"));
                myModel.put("apellido", hsr.getParameter("apellido"));
                return new ModelAndView("nombreUsuario","model",myModel);
            }else{
                return new ModelAndView("hello");
            }
        }else{
            return new ModelAndView("hello");
        }

    }

    public void setLogin(login logIn) {
        this.objLogin = logIn;
    }
}
